package 饿汉单例;

public class 饿汉单例 {
    public static void main(String[] args) {
        test n1=test.S;
        //test n2=new test();//报错
        test n2=test.S;
        n2.age=10;
        System.out.println(n1.age);//10
        //n1n2指向同一个对象

    }
}
